
function AMAcheckHiddenFrame()
{
    var newFrame = window.top.document.getElementById('hidefrm');		
    if(newFrame == null) {
            newFrame = window.top.document.createElement('iframe');
            newFrame.id = 'hidefrm';
            newFrame.name = 'hidefrm';
            newFrame.width = 0;
            newFrame.height = 0;
            newFrame.src = '';
            newFrame.setAttribute("style", "display:none");
            window.top.document.body.appendChild(newFrame);
    }
}

function AMAgetCellStatus(btnCell, btnText)
{

    // mark active with !
    if(btnCell.tagName == 'B') {return '!' + btnText}

    // mark disabled with -
    // mark available with nothing
    if(btnCell.tagName == 'FORM') {
    if(btnCell.childNodes[2].getAttribute('class') == "disabled") {return '-' + btnText} else {return btnText}
    } else {
        if(btnCell.tagName == 'INPUT') {
            if(btnCell.getAttribute('class') == "disabled") {return '-' + btnText} else {return btnText}
        }
    }
}

AMAcheckHiddenFrame();
var combatModes = '';
var tblActivations;

var tables = document.getElementsByTagName('table');
for(var i = 0; i < tables.length; i++)	{
    if(tables[i].className == 'messagestyle' && tables[i].rows[0].cells[0].childNodes[0].innerHTML == 'Combat Mode:') {
        tblActivations = tables[i];
        combatModes = combatModes + '|' + AMAgetCellStatus(tblActivations.rows[0].cells[0].childNodes[2], 'offensive');
        combatModes = combatModes + '|' + AMAgetCellStatus(tblActivations.rows[0].cells[0].childNodes[4], 'balanced');
        combatModes = combatModes + '|' + AMAgetCellStatus(tblActivations.rows[0].cells[0].childNodes[6], 'defensive');
        // store combat modes
        localStorage.setItem('ama_combatModes', combatModes);
    }
}
